home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / PInterfaces / fp.p < prev    next >
Encoding:
Text File  |  1998-02-12  |  26.1 KB  |  619 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        fp.p
  3.  
  4.      Contains:    FPCE Floating-Point Definitions and Declarations.
  5.  
  6.      Version:    Technology:    MathLib v2
  7.                  Release:    Universal Interfaces 3.1
  8.  
  9.      Copyright:    © 1987-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT fp;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __FP__}
  28. {$SETC __FP__ := 1}
  29.  
  30. {$I+}
  31. {$SETC fpIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __CONDITIONALMACROS__}
  35. {$I ConditionalMacros.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __MACTYPES__}
  38. {$I MacTypes.p}
  39. {$ENDC}
  40.  
  41. {*******************************************************************************
  42. *                                                                               *
  43. *    A collection of numerical functions designed to facilitate a wide          *
  44. *    range of numerical programming as required by C9X.                         *
  45. *                                                                               *
  46. *    The <fp.h> declares many functions in support of numerical programming.    *
  47. *    It provides a superset of <math.h> and <SANE.h> functions.  Some           *
  48. *    functionality previously found in <SANE.h> and not in the FPCE <fp.h>      *
  49. *    can be found in this <fp.h> under the heading "__NOEXTENSIONS__".          *
  50. *                                                                               *
  51. *    All of these functions are IEEE 754 aware and treat exceptions, NaNs,      *
  52. *    positive and negative zero and infinity consistent with the floating-      *
  53. *    point standard.                                                            *
  54. *                                                                               *
  55. *******************************************************************************}
  56.  
  57.  
  58. {$PUSH}
  59. {$ALIGN MAC68K}
  60. {$LibExport+}
  61.  
  62. {*******************************************************************************
  63. *                                                                               *
  64. *                            Efficient types                                    *
  65. *                                                                               *
  66. *    float_t         Most efficient type at least as wide as float              *
  67. *    double_t        Most efficient type at least as wide as double             *
  68. *                                                                               *
  69. *      CPU            float_t(bits)                double_t(bits)               *
  70. *    --------        -----------------            -----------------             *
  71. *    PowerPC          float(32)                    double(64)                   *
  72. *    68K              long double(80/96)           long double(80/96)           *
  73. *    x86              long double(80)              long double(80)              *
  74. *                                                                               *
  75. *******************************************************************************}
  76. {$IFC TARGET_CPU_PPC }
  77.  
  78. TYPE
  79.     float_t                                = Single;
  80.     double_t                            = Double;
  81. {$ELSEC}
  82. {$IFC TARGET_CPU_68K }
  83. TYPE
  84.     float_t                             = extended;
  85.     double_t                            = extended;
  86. {$ELSEC}
  87. {$IFC TARGET_CPU_X86 }
  88. {$IFC NeXT }
  89.  
  90. TYPE
  91.     float_t                                = Double;
  92.     double_t                            = Double;
  93. {$ELSEC}
  94.  
  95. TYPE
  96.     float_t                                = LongDouble;
  97.     double_t                            = LongDouble;
  98. {$ENDC}
  99. {$ELSEC}
  100. {$IFC TARGET_CPU_MIPS }
  101.  
  102. TYPE
  103.     float_t                                = Double;
  104.     double_t                            = Double;
  105. {$ELSEC}
  106. {$IFC TARGET_CPU_ALPHA }
  107.  
  108. TYPE
  109.     float_t                                = Double;
  110.     double_t                            = Double;
  111. {$ELSEC}
  112. {$IFC TARGET_CPU_SPARC }
  113.  
  114. TYPE
  115.     float_t                                = Double;
  116.     double_t                            = Double;
  117. {$ELSEC}
  118. { Unsupported CPU }
  119. {$ENDC}
  120. {$ENDC}
  121. {$ENDC}
  122. {$ENDC}
  123. {$ENDC}
  124. {$ENDC}
  125.  
  126.  
  127. {*******************************************************************************
  128. *                                                                               *
  129. *                              Define some constants.                           *
  130. *                                                                               *
  131. *    HUGE_VAL            IEEE 754 value of infinity.                            *
  132. *    INFINITY            IEEE 754 value of infinity.                            *
  133. *    NAN                 A generic NaN (Not A Number).                          *
  134. *    DECIMAL_DIG         Satisfies the constraint that the conversion from      *
  135. *                        double to decimal and back is the identity function.   *
  136. *                                                                               *
  137. *******************************************************************************}
  138.  
  139. CONST
  140. {$IFC TARGET_CPU_PPC }
  141.     DECIMAL_DIG                            = 17;  
  142. {$ELSEC}
  143.     DECIMAL_DIG                            = 21;
  144. {$ENDC}
  145.  
  146. {$IFC TARGET_OS_MAC }
  147. {*******************************************************************************
  148. *                                                                               *
  149. *                            Trigonometric functions                            *
  150. *                                                                               *
  151. *   acos        result is in [0,pi].                                            *
  152. *   asin        result is in [-pi/2,pi/2].                                      *
  153. *   atan        result is in [-pi/2,pi/2].                                      *
  154. *   atan2       Computes the arc tangent of y/x in [-pi,pi] using the sign of   *
  155. *               both arguments to determine the quadrant of the computed value. *
  156. *                                                                               *
  157. *******************************************************************************}
  158. FUNCTION cos(x: double_t): double_t; C;
  159. FUNCTION sin(x: double_t): double_t; C;
  160. FUNCTION tan(x: double_t): double_t; C;
  161. FUNCTION acos(x: double_t): double_t; C;
  162. FUNCTION asin(x: double_t): double_t; C;
  163. FUNCTION atan(x: double_t): double_t; C;
  164. FUNCTION atan2(y: double_t; x: double_t): double_t; C;
  165.  
  166.  
  167. {*******************************************************************************
  168. *                                                                                *
  169. *                              Hyperbolic functions                             *
  170. *                                                                                *
  171. *******************************************************************************}
  172. FUNCTION cosh(x: double_t): double_t; C;
  173. FUNCTION sinh(x: double_t): double_t; C;
  174. FUNCTION tanh(x: double_t): double_t; C;
  175. FUNCTION acosh(x: double_t): double_t; C;
  176. FUNCTION asinh(x: double_t): double_t; C;
  177. FUNCTION atanh(x: double_t): double_t; C;
  178.  
  179.  
  180. {*******************************************************************************
  181. *                                                                                *
  182. *                              Exponential functions                               *
  183. *                                                                                *
  184. *    expm1        expm1(x) = exp(x) - 1.  But, for small enough arguments,          *
  185. *                expm1(x) is expected to be more accurate than exp(x) - 1.        *
  186. *    frexp        Breaks a floating-point number into a normalized fraction       *
  187. *                and an integral power of 2.  It stores the integer in the       *
  188. *                object pointed by *exponent.                                    *
  189. *    ldexp        Multiplies a floating-point    number by an integer power of 2.    *
  190. *    log1p        log1p = log(1 + x). But, for small enough arguments,              *
  191. *                 log1p is expected to be more accurate than log(1 + x).          *
  192. *    logb        Extracts the exponent of its argument, as a signed integral        *
  193. *                  value. A subnormal argument is treated as though it were first    *
  194. *                  normalized. Thus:                                                *
  195. *                                     1   <=   x * 2^(-logb(x))   <   2             *
  196. *    modf        Returns fractional part of x as function result and returns     *
  197. *                integral part of x via iptr. Note C9X uses double not double_t.    *
  198. *    scalb        Computes x * 2^n efficently.  This is not normally done by        *
  199. *                  computing 2^n explicitly.                                         *
  200. *                                                                                *
  201. *******************************************************************************}
  202. FUNCTION exp(x: double_t): double_t; C;
  203. FUNCTION expm1(x: double_t): double_t; C;
  204. FUNCTION exp2(x: double_t): double_t; C;
  205. FUNCTION frexp(x: double_t; VAR exponent: LONGINT): double_t; C;
  206. FUNCTION ldexp(x: double_t; n: LONGINT): double_t; C;
  207. FUNCTION log(x: double_t): double_t; C;
  208. FUNCTION log2(x: double_t): double_t; C;
  209. FUNCTION log1p(x: double_t): double_t; C;
  210. FUNCTION log10(x: double_t): double_t; C;
  211. FUNCTION logb(x: double_t): double_t; C;
  212. FUNCTION modf(x: double_t; VAR iptr: double_t): double_t; C;
  213. FUNCTION modff(x: Single; VAR iptrf: Single): Single; C;
  214. FUNCTION scalb(x: double_t; n: LONGINT): double_t; C;
  215.  
  216.  
  217. {*******************************************************************************
  218. *                                                                                *
  219. *                     Power and absolute value functions                          *
  220. *                                                                                *
  221. *    hypot        Computes the square root of the sum of the squares of its        *
  222. *                  arguments, without undue overflow or underflow.                 *
  223. *    pow            Returns x raised to the power of y.  Result is more accurate    *
  224. *                than using exp(log(x)*y).                                        *
  225. *                                                                                *
  226. *******************************************************************************}
  227. FUNCTION fabs(x: double_t): double_t; C;
  228. FUNCTION hypot(x: double_t; y: double_t): double_t; C;
  229. FUNCTION pow(x: double_t; y: double_t): double_t; C;
  230. FUNCTION sqrt(x: double_t): double_t; C;
  231.  
  232.  
  233. {*******************************************************************************
  234. *                                                                                 *
  235. *                        Gamma and Error functions                               *
  236. *                                                                                 *
  237. *     erf            The error function.                                             *
  238. *     erfc        Complementary error function.                                      *
  239. *     gamma        The gamma function.                                                *
  240. *     lgamma        Computes the base-e logarithm of the absolute value of            *
  241. *                 gamma of its argument x, for x > 0.                                *
  242. *                                                                                 *
  243. *******************************************************************************}
  244. FUNCTION erf(x: double_t): double_t; C;
  245. FUNCTION erfc(x: double_t): double_t; C;
  246. FUNCTION gamma(x: double_t): double_t; C;
  247. FUNCTION lgamma(x: double_t): double_t; C;
  248.  
  249.  
  250. {*******************************************************************************
  251. *                                                                                 *
  252. *                        Nearest integer functions                                 *
  253. *                                                                                 *
  254. *     rint        Rounds its argument to an integral value in floating point         *
  255. *                  format, honoring the current rounding direction.                   *
  256. *                                                                                 *
  257. *     nearbyint    Differs from rint only in that it does not raise the inexact    *
  258. *               exception. It is the nearbyint function recommended by the        *
  259. *                  IEEE floating-point standard 854.                                  *
  260. *                                                                                 *
  261. *     rinttol        Rounds its argument to the nearest long int using the current     *
  262. *                  rounding direction.  NOTE: if the rounded value is outside        *
  263. *                the range of long int, then the result is undefined.              *
  264. *                                                                                  *
  265. *     round        Rounds the argument to the nearest integral value in floating     *
  266. *                  point format similar to the Fortran "anint" function. That is:  *
  267. *                  add half to the magnitude and chop.                             *
  268. *                                                                                 *
  269. *     roundtol    Similar to the Fortran function nint or to the Pascal round.    *
  270. *                 NOTE: if the rounded value is outside the range of long int,    *
  271. *                  then the result is undefined.                                      *
  272. *                                                                                 *
  273. *     trunc        Computes the integral value, in floating format, nearest to        *
  274. *                 but no larger in magnitude than its argument.      NOTE: on 68K    *
  275. *                compilers when using -elems881, trunc must return an int        *
  276. *                                                                                 *
  277. *******************************************************************************}
  278. FUNCTION ceil(x: double_t): double_t; C;
  279. FUNCTION floor(x: double_t): double_t; C;
  280. FUNCTION rint(x: double_t): double_t; C;
  281. FUNCTION nearbyint(x: double_t): double_t; C;
  282. FUNCTION rinttol(x: double_t): LONGINT; C;
  283. FUNCTION round(x: double_t): double_t; C;
  284. FUNCTION roundtol(round: double_t): LONGINT; C;
  285. {$IFC TARGET_CPU_68K }
  286. FUNCTION trunc(x: double_t): LONGINT; C;
  287. {$ELSEC}
  288. FUNCTION trunc(x: double_t): double_t; C;
  289. {$ENDC}
  290.  
  291. {*******************************************************************************
  292. *                                                                                 *
  293. *                            Remainder functions                                   *
  294. *                                                                                 *
  295. *     remainder        IEEE 754 floating point standard for remainder.                *
  296. *     remquo            SANE remainder.  It stores into 'quotient' the 7 low-order    *
  297. *                    bits of the integer quotient x/y, such that:                *
  298. *                        -127 <= quotient <= 127.                                 *
  299. *                                                                                 *
  300. *******************************************************************************}
  301. FUNCTION fmod(x: double_t; y: double_t): double_t; C;
  302. FUNCTION remainder(x: double_t; y: double_t): double_t; C;
  303. FUNCTION remquo(x: double_t; y: double_t; VAR quo: LONGINT): double_t; C;
  304.  
  305.  
  306. {*******************************************************************************
  307. *                                                                                 *
  308. *                             Auxiliary functions                               *
  309. *                                                                                 *
  310. *     copysign        Produces a value with the magnitude of its first argument    *
  311. *                      and sign of its second argument.  NOTE: the order of the     *
  312. *                      arguments matches the recommendation of the IEEE 754         *
  313. *                    floating point standard,  which is opposite from the SANE    *
  314. *                    copysign function.                                             *
  315. *                                                                                 *
  316. *     nan                The call 'nan("n-char-sequence")' returns a quiet NaN         *
  317. *                      with content indicated through tagp in the selected         *
  318. *                    data type format.                                              *
  319. *                                                                                *
  320. *     nextafter        Computes the next representable value after 'x' in the         *
  321. *                    direction of 'y'.  if x == y, then y is returned.            *
  322. *                                                                                 *
  323. *******************************************************************************}
  324. FUNCTION copysign(x: double_t; y: double_t): double_t; C;
  325. FUNCTION nan(tagp: ConstCStringPtr): Double; C;
  326. FUNCTION nanf(tagp: ConstCStringPtr): Single; C;
  327. FUNCTION nextafterd(x: Double; y: Double): Double; C;
  328. FUNCTION nextafterf(x: Single; y: Single): Single; C;
  329.  
  330.  
  331. {*******************************************************************************
  332. *                                                                                 *
  333. *                              Inquiry macros                                   *
  334. *                                                                                 *
  335. *     fpclassify        Returns one of the FP_≈ values.                                *
  336. *     isnormal        Non-zero if and only if the argument x is normalized.          *
  337. *     isfinite        Non-zero if and only if the argument x is finite.             *
  338. *     isnan            Non-zero if and only if the argument x is a NaN.              *
  339. *     signbit            Non-zero if and only if the sign of the argument x is        *
  340. *                      negative.  This includes, NaNs, infinities and zeros.         *
  341. *                                                                                 *
  342. *******************************************************************************}
  343.  
  344. CONST
  345.     FP_SNAN                        = 0;                            {       signaling NaN                          }
  346.     FP_QNAN                        = 1;                            {       quiet NaN                              }
  347.     FP_INFINITE                    = 2;                            {       + or - infinity                        }
  348.     FP_ZERO                        = 3;                            {       + or - zero                            }
  349.     FP_NORMAL                    = 4;                            {       all normal numbers                     }
  350.     FP_SUBNORMAL                = 5;                            {       denormal numbers                       }
  351.  
  352. FUNCTION __fpclassifyd(x: Double): LONGINT; C;
  353. FUNCTION __fpclassifyf(x: Single): LONGINT; C;
  354. FUNCTION __isnormald(x: Double): LONGINT; C;
  355. FUNCTION __isnormalf(x: Single): LONGINT; C;
  356. FUNCTION __isfinited(x: Double): LONGINT; C;
  357. FUNCTION __isfinitef(x: Single): LONGINT; C;
  358. FUNCTION __isnand(x: Double): LONGINT; C;
  359. FUNCTION __isnanf(x: Single): LONGINT; C;
  360. FUNCTION __signbitd(x: Double): LONGINT; C;
  361. FUNCTION __signbitf(x: Single): LONGINT; C;
  362. FUNCTION __inf: double_t; C;
  363.  
  364.  
  365. {*******************************************************************************
  366. *                                                                                 *
  367. *                      Max, Min and Positive Difference                         *
  368. *                                                                                 *
  369. *     fdim        Determines the 'positive difference' between its arguments:     *
  370. *                ( x - y, if x > y ), ( +0, if x <= y ).  If one argument is        *
  371. *                  NaN, then fdim returns that NaN.  if both arguments are NaNs,     *
  372. *                 then fdim returns the first argument.                            *
  373. *                                                                                 *
  374. *     fmax        Returns the maximum of the two arguments.  Corresponds to the    *
  375. *                max function in FORTRAN.  NaN arguments are treated as missing     *
  376. *                data.  If one argument is NaN and the other is a number, then     *
  377. *                the number is returned.  If both are NaNs then the first         *
  378. *                argument is returned.                                             *
  379. *                                                                                 *
  380. *     fmin        Returns the minimum of the two arguments.  Corresponds to the    *
  381. *                min function in FORTRAN.  NaN arguments are treated as missing     *
  382. *                data.  If one argument is NaN and the other is a number, then     *
  383. *                the number is returned.  If both are NaNs then the first         *
  384. *                argument is returned.                                            *
  385. *                                                                                 *
  386. *******************************************************************************}
  387. FUNCTION fdim(x: double_t; y: double_t): double_t; C;
  388. FUNCTION fmax(x: double_t; y: double_t): double_t; C;
  389. FUNCTION fmin(x: double_t; y: double_t): double_t; C;
  390.  
  391.  
  392. {******************************************************************************
  393. *                                Constants                                     *
  394. ******************************************************************************}
  395. {$IFC NOT UNDEFINED MWERKS}
  396.     {$IFC MWERKS > $1500}
  397.         CONST pi : double_t = 3.1415926535;
  398.     {$ENDC}
  399. {$ENDC}
  400.  
  401.  
  402. {*******************************************************************************
  403. *                                                                                 *
  404. *                              Non NCEG extensions                                *
  405. *                                                                                 *
  406. *******************************************************************************}
  407. {$IFC UNDEFINED __NOEXTENSIONS__ }
  408. {*******************************************************************************
  409. *                                                                                 *
  410. *                              Financial functions                              *
  411. *                                                                                 *
  412. *     compound        Computes the compound interest factor "(1 + rate)^periods"    *
  413. *                      more accurately than the straightforward computation with     *
  414. *                    the Power function.  This is SANE's compound function.      *
  415. *                                                                                 *
  416. *     annuity            Computes the present value factor for an annuity             *
  417. *                      "(1 - (1 + rate)^(-periods)) /rate" more accurately than    *
  418. *                    the straightforward computation with the Power function.     *
  419. *                    This is SANE's annuity function.                              *
  420. *                                                                                 *
  421. *******************************************************************************}
  422. FUNCTION compound(rate: double_t; periods: double_t): double_t; C;
  423. FUNCTION annuity(rate: double_t; periods: double_t): double_t; C;
  424.  
  425.  
  426. {*******************************************************************************
  427. *                                                                                 *
  428. *                              Random function                                  *
  429. *                                                                                 *
  430. *     randomx            A pseudorandom number generator.  It uses the iteration:    *
  431. *                                (75*x)mod(2^31-1)                                *
  432. *                                                                                 *
  433. *******************************************************************************}
  434. FUNCTION randomx(VAR x: double_t): double_t; C;
  435.  
  436.  
  437. {******************************************************************************
  438. *                              Relational operator                             *
  439. ******************************************************************************}
  440. {      relational operator      }
  441.  
  442. TYPE
  443.     relop                                = INTEGER;
  444.  
  445. CONST
  446.     GREATERTHAN                    = 0;
  447.     LESSTHAN                    = 1;
  448.     EQUALTO                        = 2;
  449.     UNORDERED                    = 3;
  450.  
  451. FUNCTION relation(x: double_t; y: double_t): relop; C;
  452.  
  453.  
  454. {*******************************************************************************
  455. *                                                                                 *
  456. *                         Binary to decimal conversions                         *
  457. *                                                                                 *
  458. *     SIGDIGLEN    Significant decimal digits.                                        *
  459. *                                                                                 *
  460. *     decimal        A record which provides an intermediate unpacked form for        *
  461. *                programmers who wish to do their own parsing of numeric input     *
  462. *                or formatting of numeric output.                                  *
  463. *                                                                                 *
  464. *     decform        Controls each conversion to a decimal string.  The style field     *
  465. *                is either FLOATDECIMAL or FIXEDDECIMAL. If FLOATDECIMAL, the     *
  466. *                value of the field digits is the number of significant digits.  *
  467. *                  If FIXEDDECIMAL value of the field digits is the number of        *
  468. *                digits to the right of the decimal point.                         *
  469. *                                                                                 *
  470. *     num2dec        Converts a double_t to a decimal record    using a decform.        *
  471. *     dec2num        Converts a decimal record d to a double_t value.                *
  472. *     dec2str        Converts a decform and decimal to a string using a decform.        *
  473. *     str2dec        Converts a string to a decimal struct.                            *
  474. *     dec2d        Similar to dec2num except a double is returned (68k only).        *
  475. *     dec2f        Similar to dec2num except a float is returned.                    *
  476. *     dec2s        Similar to dec2num except a short is returned.                    *
  477. *     dec2l        Similar to dec2num except a long is returned.                     *
  478. *                                                                                 *
  479. *******************************************************************************}
  480.  
  481. CONST
  482. {$IFC TARGET_CPU_PPC }
  483.     SIGDIGLEN                    = 36;
  484. {$ELSEC}
  485.     SIGDIGLEN                    = 20;
  486. {$ENDC}
  487.     DECSTROUTLEN                = 80;
  488. TYPE
  489.     DecimalKind = (FLOATDECIMAL, FIXEDDECIMAL);
  490.  
  491.  
  492.     Decimal = RECORD
  493.         sgn:     0..1;            { sign 0 for +, 1 for -  }
  494.         exp:     INTEGER;
  495.         sig:     STRING[SIGDIGLEN];
  496.     END;
  497.  
  498.     Decform = RECORD
  499.         style:     DecimalKind;
  500.         digits: INTEGER;
  501.     END;
  502.  
  503. PROCEDURE num2dec({CONST}VAR f: decform; x: double_t; VAR d: decimal); C;
  504. FUNCTION dec2num({CONST}VAR d: decimal): double_t; C;
  505. PROCEDURE dec2str({CONST}VAR f: decform; {CONST}VAR d: decimal; s: CStringPtr); C;
  506. PROCEDURE str2dec(s: ConstCStringPtr; VAR ix: INTEGER; VAR d: decimal; VAR vp: INTEGER); C;
  507. {$IFC TARGET_CPU_68K }
  508. FUNCTION dec2d({CONST}VAR d: decimal): Double; C;
  509. {$ENDC}
  510. FUNCTION dec2f({CONST}VAR d: decimal): Single; C;
  511. FUNCTION dec2s({CONST}VAR d: decimal): INTEGER; C;
  512. FUNCTION dec2l({CONST}VAR d: decimal): LONGINT; C;
  513.  
  514.  
  515.  
  516. {*******************************************************************************
  517. *                                                                                 *
  518. *                         68k-only Transfer Function Prototypes                 *
  519. *                                                                                 *
  520. *******************************************************************************}
  521. {$IFC TARGET_CPU_68K }
  522. {$IFC TARGET_RT_MAC_68881 }
  523. PROCEDURE x96tox80({CONST}VAR x: extended96; VAR x80: extended80); C;
  524. PROCEDURE x80tox96({CONST}VAR x80: extended80; VAR x: extended96); C;
  525. {$ELSEC}
  526. PROCEDURE x96tox80({CONST}VAR x96: extended96; VAR x: extended80); C;
  527. PROCEDURE x80tox96({CONST}VAR x: extended80; VAR x96: extended96); C;
  528. {$ENDC}
  529. {$ENDC}
  530. {$ENDC}
  531. {*******************************************************************************
  532. *                                                                                 *
  533. *                         PowerPC-only Function Prototypes                         *
  534. *                                                                                 *
  535. *******************************************************************************}
  536.  
  537. {$IFC TARGET_CPU_PPC }
  538. FUNCTION cosl(x: LongDouble): LongDouble; C;
  539. FUNCTION sinl(x: LongDouble): LongDouble; C;
  540. FUNCTION tanl(x: LongDouble): LongDouble; C;
  541. FUNCTION acosl(x: LongDouble): LongDouble; C;
  542. FUNCTION asinl(x: LongDouble): LongDouble; C;
  543. FUNCTION atanl(x: LongDouble): LongDouble; C;
  544. FUNCTION atan2l(y: LongDouble; x: LongDouble): LongDouble; C;
  545. FUNCTION coshl(x: LongDouble): LongDouble; C;
  546. FUNCTION sinhl(x: LongDouble): LongDouble; C;
  547. FUNCTION tanhl(x: LongDouble): LongDouble; C;
  548. FUNCTION acoshl(x: LongDouble): LongDouble; C;
  549. FUNCTION asinhl(x: LongDouble): LongDouble; C;
  550. FUNCTION atanhl(x: LongDouble): LongDouble; C;
  551. FUNCTION expl(x: LongDouble): LongDouble; C;
  552. FUNCTION expm1l(x: LongDouble): LongDouble; C;
  553. FUNCTION exp2l(x: LongDouble): LongDouble; C;
  554. FUNCTION frexpl(x: LongDouble; VAR exponent: LONGINT): LongDouble; C;
  555. FUNCTION ldexpl(x: LongDouble; n: LONGINT): LongDouble; C;
  556. FUNCTION logl(x: LongDouble): LongDouble; C;
  557. FUNCTION log1pl(x: LongDouble): LongDouble; C;
  558. FUNCTION log10l(x: LongDouble): LongDouble; C;
  559. FUNCTION log2l(x: LongDouble): LongDouble; C;
  560. FUNCTION logbl(x: LongDouble): LongDouble; C;
  561. FUNCTION scalbl(x: LongDouble; n: LONGINT): LongDouble; C;
  562. FUNCTION fabsl(x: LongDouble): LongDouble; C;
  563. FUNCTION hypotl(x: LongDouble; y: LongDouble): LongDouble; C;
  564. FUNCTION powl(x: LongDouble; y: LongDouble): LongDouble; C;
  565. FUNCTION sqrtl(x: LongDouble): LongDouble; C;
  566. FUNCTION erfl(x: LongDouble): LongDouble; C;
  567. FUNCTION erfcl(x: LongDouble): LongDouble; C;
  568. FUNCTION gammal(x: LongDouble): LongDouble; C;
  569. FUNCTION lgammal(x: LongDouble): LongDouble; C;
  570. FUNCTION ceill(x: LongDouble): LongDouble; C;
  571. FUNCTION floorl(x: LongDouble): LongDouble; C;
  572. FUNCTION rintl(x: LongDouble): LongDouble; C;
  573. FUNCTION nearbyintl(x: LongDouble): LongDouble; C;
  574. FUNCTION rinttoll(x: LongDouble): LONGINT; C;
  575. FUNCTION roundl(x: LongDouble): LongDouble; C;
  576. FUNCTION roundtoll(round: LongDouble): LONGINT; C;
  577. FUNCTION truncl(x: LongDouble): LongDouble; C;
  578. FUNCTION remainderl(x: LongDouble; y: LongDouble): LongDouble; C;
  579. FUNCTION remquol(x: LongDouble; y: LongDouble; VAR quo: LONGINT): LongDouble; C;
  580. FUNCTION copysignl(x: LongDouble; y: LongDouble): LongDouble; C;
  581. FUNCTION fdiml(x: LongDouble; y: LongDouble): LongDouble; C;
  582. FUNCTION fmaxl(x: LongDouble; y: LongDouble): LongDouble; C;
  583. FUNCTION fminl(x: LongDouble; y: LongDouble): LongDouble; C;
  584.  
  585. {$IFC UNDEFINED __NOEXTENSIONS__ }
  586. FUNCTION relationl(x: LongDouble; y: LongDouble): relop; C;
  587. PROCEDURE num2decl({CONST}VAR f: decform; x: LongDouble; VAR d: decimal); C;
  588. FUNCTION dec2numl({CONST}VAR d: decimal): LongDouble; C;
  589. {    
  590.     MathLib v2 has two new transfer functions: x80tod and dtox80.  They can 
  591.     be used to directly transform 68k 80-bit extended data types to double
  592.     and back for PowerPC based machines without using the functions
  593.     x80told or ldtox80.  Double rounding may occur. 
  594. }
  595. PROCEDURE x80told({CONST}VAR x80: extended80; VAR x: LongDouble); C;
  596. PROCEDURE ldtox80({CONST}VAR x: LongDouble; VAR x80: extended80); C;
  597. FUNCTION x80tod({CONST}VAR x80: extended80): Double; C;
  598. PROCEDURE dtox80({CONST}VAR x: Double; VAR x80: extended80); C;
  599. {$ENDC}
  600. {$ENDC}
  601. {$ELSEC}
  602. {
  603.     Non-Mac platforms may have long doubles.
  604. }
  605. PROCEDURE x80told({CONST}VAR x80: extended80; VAR x: LongDouble); C;
  606. PROCEDURE ldtox80({CONST}VAR x: LongDouble; VAR x80: extended80); C;
  607. {$ENDC}  {TARGET_OS_MAC}
  608.  
  609. {$ALIGN RESET}
  610. {$POP}
  611.  
  612. {$SETC UsingIncludes := fpIncludes}
  613.  
  614. {$ENDC} {__FP__}
  615.  
  616. {$IFC NOT UsingIncludes}
  617.  END.
  618. {$ENDC}
  619.